export each axis only once non-deleted, related tdf#84347

Change-Id: Ia0e23faf43fd266b8314f807b77423e9a3e15797
diff --git a/include/oox/export/chartexport.hxx b/include/oox/export/chartexport.hxx
index 186ea75..c043fd7 100644
--- a/include/oox/export/chartexport.hxx
+++ b/include/oox/export/chartexport.hxx
@@ -30,6 +30,8 @@
#include <com/sun/star/chart2/RelativePosition.hpp>
#include <com/sun/star/chart2/RelativeSize.hpp>

#include <set>

namespace com { namespace sun { namespace star {
    namespace chart {
        class XDiagram;
@@ -103,6 +105,8 @@
    bool                mbStacked;
    bool                mbPercent;

    std::set<sal_Int32> maExportedAxis;

private:
    sal_Int32 getChartType();

diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 9c56a7e..4fcf803 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -2611,6 +2611,7 @@

    pFS->startElement( FSNS( XML_c, XML_scaling ),
            FSEND );

    // logBase, min, max
    if(GetProperty( xAxisProp, "Logarithmic" ) )
    {
@@ -2671,8 +2672,15 @@
            OUString ("Visible")) >>=  bVisible;
    }

    // only export each axis only once non-deleted
    bool bDeleted = std::find(maExportedAxis.begin(),
            maExportedAxis.end(), rAxisIdPair.nAxisType) != maExportedAxis.end();

    if (!bDeleted)
        maExportedAxis.insert(rAxisIdPair.nAxisType);

    pFS->singleElement( FSNS( XML_c, XML_delete ),
            XML_val, bVisible ? "0" : "1",
            XML_val, !bDeleted && bVisible ? "0" : "1",
            FSEND );

    // FIXME: axPos, need to check the property "ReverseDirection"